<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.5.1.js"></script>
    <script src="../js/getUrlParam.js"></script>
    <script src="../js/dateUtil.js"></script>
</head>
<body>
<div class="edit_box"></div>
<script>
    $(document).ready(function () {
        var id = getUrlParam("id");
        $.ajax({
            url:"../rotation?method=getImgById&id="+id,
            type:"get",
            dateType: "json",
            success:function (data) {
                var item = JSON.parse(data);
                var str = "<form method='post' action='../rotation?method=update' enctype='multipart/form-data\'>";
                str+="<div><label>id</label><input type='text' name='id' value='"+item.id+"'></div>";
                str+="<div><label>name</label><input type='text' name='name' value='"+item.name+"'></div>";
                str+="<div><label>url</label><input type='text' name='url' value='"+item.url+"'></div>";
                str+="<input type='button' id='changeType' value='修改图片'>"
                str+="<div><label>date</label><input type='datetime' name='date' value='"+timestampToTime(item.date)+"'></div>";
                str+="<div><label>href</label><input type='text' name='href' value='"+item.href+"'></div>"
                str+="<div><input type='submit' value='修改'></div>";
                str+="</form>";
                $(".edit_box").append(str);
            },error:function () {
               alert("系统异常")
            }
        })
        //这里注意
        $(document).on("click","#changeType",function () {
            alert("改变")
          $("[name='url']").attr("type","file");
        })
    })
</script>
</body>
</html>